package stream;

import java.util.Collection;
import java.util.*;
import java.util.stream.Collectors;

public class GeneratorVariousCollection {

    public static void main(String[] args) {
        System.out.println(toList(List.of("A", "B", "c")));

        toMap(List.of(1, 2, 3, 4)).forEach((k, v) -> System.out.println(k + "，" + v));

    }


    public static <T> List<T> toList(Collection collection) {
        return (List<T>)collection
            .stream()
            .filter(c -> !c.equals("A"))
            .collect(Collectors.toList());
    }

    public static Map<Integer, Integer> toMap(List<Integer> integers) {
        return integers
            .stream()
            .collect(Collectors.toMap(i -> i, i -> i +1));
    }

}


